cmake_minimum_required (VERSION 3.16)

project ("ciallo_imgui" LANGUAGES CXX)

add_library(
	ciallo_imgui

	app.cpp
	image.cpp
	demo_window.cpp
)

target_include_directories(
	ciallo_imgui

	SYSTEM PUBLIC

	${CMAKE_CURRENT_SOURCE_DIR}/include
)

target_link_libraries(
	ciallo_imgui

	PUBLIC

	imgui_lib
)

if (MSVC)
	string (REGEX REPLACE "/EH[a-z]+-?" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
	set (IMGW_NO_EXCEPTIONS /EHc-)
	set (IMGW_ALL_WARNINGS  /W3)
	set (IMGW_NO_RTTI /GR-)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
	set (IMGW_NO_EXCEPTIONS -fno-exceptions)
	set (IMGW_ALL_WARNINGS  -Wall -Werror -Wextra -Wpedantic)
	set (IMGW_NO_RTTI -fno-rtti)
else ()
	message (WARNING "CMAKE_CXX_FLAGS not set for compiler ${CMAKE_CXX_COMPILER_ID}")
endif ()

target_compile_options(ciallo_imgui PRIVATE ${IMGW_NO_RTTI} ${IMGW_NO_EXCEPTIONS} ${IMGW_ALL_WARNINGS})